<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/XGameAdmin_template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<?php
include('lock.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
{
	if(empty($_POST['quantity']))
	{
		$quantity=0;
	}
	else
	{
		$quantity=addslashes($_POST['quantity']);
	}
	$locationid=addslashes($_POST['location']);
	$demoid=addslashes($_POST['name']);
	
	$sql="INSERT INTO stock (game_ID,game_stock,location_ID) Values ('$demoid','$quantity','$locationid')";
	mysql_query($sql);
	 header('Location: AdminStock.php');
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>XGame</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->

<!-- InstanceEndEditable -->
<link type="text/css" rel="stylesheet" href="CSS/adminCSS.css" />
</head>

<body>
<div id="container">

<div id="wrapper">

<div id="banner">
<ul class="topLink">
<li> Welcome, Admin </li>
<li> <a href="Logout.php"> Logout </a> </li>
</ul>

<img src="Assets/XGame.png" alt="XGame" />
</div>

<div id="menu">

<ul class="nav">
<li> <a href="AdminMember.php"> Member </a> </li>
<li> <a href="AdminNews.php"> News </a> </li>
<li> <a href="AdminGames.php"> Games </a> </li>
<li> <a href="AdminStock.php"> Stock </a> </li>
<li> <a href="AdminOrder.php"> Order </a> </li>
<li> <a href="AdminHistory.php"> History </a> </li>
</ul>

</div>

<div id="main">
<!-- InstanceBeginEditable name="Main" -->
<form id="registerUpdate" name="registerUpdate" method="POST">
<h3> Product Particular </h3>

<label>Product</label>
<select name="name">
<?php
	$sql="SELECT * FROM demo";
	$result=mysql_query($sql);
	while($data_fetch=mysql_fetch_array($result))
	{
	echo "<option value=".$data_fetch['demo_ID'].">".$data_fetch['demo_name']."</option>";
	}
?>
</select>


<label>Quantity</label>
<input type="text" name="quantity" />

<label>Location</label>
<select name="location">
<?php
	$sql="SELECT * FROM location";
	$result=mysql_query($sql);
	while($data_fetch=mysql_fetch_array($result))
	{
	echo "<option value=".$data_fetch['location_ID'].">".$data_fetch['location_name']."</option>";
	}
?>
</select>

<button type="submit">Add Stock</button>

</form>
<!-- InstanceEndEditable -->
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 XGame </p>
</div>

</div>

</div>

</body>
<!-- InstanceEnd --></html>
